
package com.dps.omc.service.impl;
import com.dps.omc.model.Job;
import com.dps.common.utils.IdGenerator;
import com.dps.omc.dao.IJobBizUnitDAO;
import com.dps.omc.model.JobBizUnit;
import com.dps.omc.service.IJobBizUnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dps.common.service.impl.AbstractPageService;

import java.util.List;

@SuppressWarnings("unchecked")
@Service("JobBizUnitServiceImpl")

public class JobBizUnitServiceImpl extends AbstractPageService<IJobBizUnitDAO,JobBizUnit> implements IJobBizUnitService {

	@Autowired
	private IJobBizUnitDAO jobBizUnitDAO;
	@Override
	public boolean getEnableDataPerm() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public IJobBizUnitDAO getDao() {
		return jobBizUnitDAO;
	}

	@Override
	public void create(Job job, List<String> bizUnits) {

		for(String bizUnit:bizUnits)
		{
			JobBizUnit jobBizUnit = new JobBizUnit();
			jobBizUnit.setId(IdGenerator.createNewId());
			jobBizUnit.setJobId(job.getId());
			jobBizUnit.setBizUnit(bizUnit);
			this.insert(jobBizUnit);
		}
	}
}
